<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
  <style type="text/css">
    #box1 {
      width: 100px;
      height: 100px;
      background-color: #489EE2;
    }
  </style>
  <script>
    let time = '';
    let lock = true;
    let num = 1;
    const down = () => {
    	time = setInterval(() => {
        num++;
				console.log(num);
				lock = false;
			}, 100)
    };

    const up = () => {
    	clearInterval(time);
			setTimeout(() => {
    		lock = true;
      })
    };

    const cli = () => {
    	if (lock) {
				console.log("单击事件");
			}
    }

  </script>
</head>
<body>

<div id="box1" onmousedown="down()" onmouseup="up()">

</div>

</body>
</html>
